package com.bemes.ecmn.model;

public class ECMNDifAggregator extends ECMNAggregator{

	@Override
	public int getAmountOfEquipment() {
		
		if(m_connectors.size() == 2)
		{
			return Math.abs(m_connectors.get(0).getAmountOfEquipment() - m_connectors.get(1).getAmountOfEquipment());
		}
		else
		{
			return 0;
		}
	}
	
	@Override
	public boolean AddConnector(ECMNConnector con)
	{
		if(con != null)
		{
			// Number of children of this aggregator is limited to 2
			if(m_connectors.size() < 2)
			{
				m_connectors.add(con);
				return true;
			}
		}
		
		return false;
	}
}
